package com.eling.elcms.basedoc.webapp.controller;

import com.eling.elcms.basedoc.model.AdministrativeDivision;
import com.eling.elcms.basedoc.model.view.AdministrativeDivisionCond;
import com.eling.elcms.basedoc.service.IAdminDivisionService;
import com.eling.elcms.core.webapp.controller.BaseFormController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;


/**
 * 行政区划的controller
 * @author
 *
 */
@Controller
public class AdminDivisionController extends BaseFormController {
	@Autowired
	private IAdminDivisionService service;
	
	//查询
	@RequestMapping("/api/admindivision/query")
	@ResponseBody
	public List<AdministrativeDivision> query(@ModelAttribute AdministrativeDivisionCond cond){
		
		return service.query(cond);
	}

	@RequestMapping("/api/admindivision*")
	@ResponseBody
	public List<AdministrativeDivision> queryAd(@RequestParam(value = "parentCode", required = false) String parentCode) {
		return service.queryByParent(parentCode);
	}
}
